package Compation;

import java.util.ArrayList;
import java.util.List;

class createTargetArray {
    public int[] createTargetArray(int[] nums, int[] index) {
        if (nums == null || index == null || nums.length <= 0 || index.length <= 0) {
            return null;
        }
        List<Integer> res = new ArrayList<>();
        int length = index.length;

        for (int i = 0; i < length; i++) {
            res.add(i, nums[i]);
        }
        int[] target = new int[res.size()];
        for (int i = 0; i < res.size(); i++) {
            target[i] = res.get(i);
        }
        return target;
    }
}